package com.it.bean;
import java.util.Scanner;
public class User {
    //用户属性  私有属性，共有方法setter/getter
    private String username;
    private String password;
    private int age;
    private  String addr;
    //this 区分全局和局部
    public void setUsername(String username){
        //局部给全局赋值
        this.username = username;
    }
    //getter  this可以省去
    public String getUsername(){
        return  username;
    }

    public void setPassword(String password){
        this.password = password;
    }
    public String getPassword(){
        return  password;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    //打印对象本身
    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", age=" + age +
                ", addr='" + addr + '\'' +
                '}';
    }
}


